/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.republicagroup.gestion.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author DIEGOALV
 */
@Entity
@Table(name = "cuenta_banco")
@NamedQueries({
    @NamedQuery(name = "CuentaBanco.findAll", query = "SELECT c FROM CuentaBanco c")})
public class CuentaBanco implements Serializable {
    
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @Column(name = "numero")
    private String numero;
    @Basic(optional = false)
    @Column(name = "cbu")
    private String cbu;
    @Basic(optional = false)
    @Column(name = "estado")
    private int estado;
    @OneToMany(mappedBy = "cuentaBancoId")
    private List<Caja> cajaList;
    @OneToMany(mappedBy = "cuentaBancoId")
    private List<Cheque> chequeList;
    @JoinColumn(name = "banco_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Banco bancoId;
    @JoinColumn(name = "cuenta_tipo_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private CuentaTipo cuentaTipoId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cuentaBancoId")
    private List<Deposito> depositoList;

    public CuentaBanco() {
    }

    public CuentaBanco(Integer id) {
        this.id = id;
    }

    public CuentaBanco(Integer id, String nombre, String numero, String cbu, int estado) {
        this.id = id;
        this.nombre = nombre;
        this.numero = numero;
        this.cbu = cbu;
        this.estado = estado;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getNumero() {
        return numero;
    }

    public void setNumero(String numero) {
        this.numero = numero;
    }

    public String getCbu() {
        return cbu;
    }

    public void setCbu(String cbu) {
        this.cbu = cbu;
    }

    public int getEstado() {
        return estado;
    }

    public void setEstado(int estado) {
        this.estado = estado;
    }

    public List<Caja> getCajaList() {
        return cajaList;
    }

    public void setCajaList(List<Caja> cajaList) {
        this.cajaList = cajaList;
    }

    public Banco getBancoId() {
        return bancoId;
    }

    public void setBancoId(Banco bancoId) {
        this.bancoId = bancoId;
    }

    public CuentaTipo getCuentaTipoId() {
        return cuentaTipoId;
    }

    public void setCuentaTipoId(CuentaTipo cuentaTipoId) {
        this.cuentaTipoId = cuentaTipoId;
    }

    
    public List<Cheque> getChequeList() {
        return chequeList;
    }

    public void setChequeList(List<Cheque> chequeList) {
        this.chequeList = chequeList;
    }
    
 
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CuentaBanco)) {
            return false;
        }
        CuentaBanco other = (CuentaBanco) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
       return getNombre();
    }

    public List<Deposito> getDepositoList() {
        return depositoList;
    }

    public void setDepositoList(List<Deposito> depositoList) {
        this.depositoList = depositoList;
    }
    
}
